package module3;

import java.util.ArrayList;
import java.util.List;

public class StudentList {

    //1、首先创建一个集合
    List list = new ArrayList();

   //2、增删改查遍历的操作功能
    public void show1(String name, String number, int age) {
        list.add(new StudentInformation(name, number, age));
    }
    public void show2(int i) {
        if (i <= list.size()) {
            list.remove(i-1);
        }else System.out.println("没有这位学生哦^-^");
    }
    public  void show3(int i, String name, String number, int age) {
        Object obj = new StudentInformation(name, number, age);
        list.set(i-1, obj);
    }
    public Object show4(String str) {
        for (Object obj : list) {
            if (str.equalsIgnoreCase(((StudentInformation)obj).getName())) {
                return obj;
            }
        }
        return "没有这位学生哦！^-^";
    }
    public void show5() {
        for (Object obj : list) {
            System.out.println(obj);
        }
    }

}
